<template>
	<uni-popup ref="popup" type="center" :mask-click="false">
		<view class="column-css"
			style="margin: 0 60rpx; align-items: center;background: #FFFFFF;border-radius: 20rpx;">
			<view class="column-css"
				style="width: 100%; background: #007AFF;color: #FFFFFF;padding-bottom: 20rpx; border-top-left-radius: 20rpx;border-top-right-radius: 20rpx;position: relative;">
				<view style="font-size: 54rpx;position: absolute;right: 30rpx;top: 10rpx;" @click="close()">×
				</view>
				<view style="padding: 10rpx;font-size: 36rpx; margin-bottom: 10rpx;text-align: center;padding-top: 40rpx;">
					接单提示
				</view>
				<view class="column-css" style="padding: 0 20rpx;padding-bottom: 80rpx;">
					为了保障您在使用运单（接单、运费、结算）相关服务时的合法权益，请您完整相关运输合规资质认证。
				</view>
			</view>
	
			<view class="row-css view-sold-real" style="margin: 30rpx auto;" @click="onreal(0)">
				<view class="row-css">
					<image style="width: 50rpx;height: 45rpx;margin-right: 10rpx;" src="/static/icon_real.png">
					</image>
					实名认证
				</view>
				<view class="row-css" style="margin-left: 10rpx;"
					:style="{ color: '#F3A73F','font-weight': 'bold' }">
					{{ shipInfo.captainStatus === '0' ? '未认证' : '已认证'}}
					<image style="width: 40rpx;height: 33rpx;padding: 5rpx 0;" src="/static/icon_enter.png">
					</image>
				</view>
				
			</view>
		</view>
	</uni-popup>
</template>

<script>
const app = getApp()
export default {
	props: {
		shipInfo: {
			type: Object,
			default: function() {
				return {}
			}
		},
		showAuth: {
			type: Boolean,
			default: false
		}
	},
	data() {
		return {
			// shipInfo: {}
		}
	},
	computed: {
		// showAuth() {
		// 	return this.shipInfo.captainStatus === '0'
		// }
	},
	watch: {
		showAuth: {
		  handler: function (newValue, oldValue) {
		    if (typeof oldValue === 'undefined' && !newValue) {
		      return;
		    }
		    if (newValue) {
					this.$nextTick(()=>{
						this.$refs['popup'].open()
					})
		    } else {
					this.$nextTick(()=>{
						this.$refs['popup'].close()
					})
		    }
		  },
		  immediate: true,
		},
	},
	mounted() {
		// this.getShipInfo()
	},
	methods: {
		close() {
			this.$refs['popup'].close()
			app.globalData.shipModal = 1
		},
		getShipInfo() {
			this.wxRequest({
				url: `${this.API}/captainApp/captainAuthentication?etpId=${uni.getStorageSync(this.DATA_KEY.etpId)}`,
				method: 'GET',
				success: res => {
					if (res.data.code == 0) {
						this.shipInfo = res.data.data
					}
				}
			});
		},
		onreal() {
			if (this.shipInfo.captainStatus === '0' && this.shipInfo.platformDriverLiveStatus === '0') {
				uni.navigateTo({
					url: '/pages/ship/user/infoSet'
				})
			} else {
				uni.navigateTo({
					url: '/pages/ship/user/info'
				})
			}
		}
	}
}
</script>

<style lang="scss">
.column {
		display: flex;
		display: -webkit-flex;
		flex-direction: column;
		-webkit-flex-direction: column;
	}

	.row-css {
		display: flex;
		flex-direction: row;
	}

.column-css {
		display: flex;
		flex-direction: column;
		.messagetips{
			float: right;
			position: relative;
			right: 0;
			text{
				padding: 10rpx;
				color: #FFFFFF;
				border-radius: 10rpx;
				right: 5rpx;
				background: #ff1606;
				position: absolute;
				font-size: 24rpx;
			}
			.tipstext{
				padding: 0rpx 8rpx;
				border-radius: 12rpx;
				right: -6rpx;
				top: -10rpx;
			}
		}
	}
	.view-rodio-ativc {
		width: 15rpx;
		height: 15rpx;
		margin: 7.5rpx;
		border-radius: 50%;
	}
	
	.view-sold-real {
		width: 80%;
		border: 1rpx solid #DCDFE6;
		background: #FFFFFF;
		border-radius: 10rpx;
		padding: 18rpx 15rpx;
		justify-content: space-between;
	}
</style>